package worldinruin.utils;

import java.awt.Graphics;
import java.awt.Image;

import javax.swing.JLabel;

public class ResizableLabel extends JLabel {
	
	private Image img;
	
	/**
	 * Creates a resizable label.
	 */
	public ResizableLabel() {
		
	}
	
	/**
	 * Creates a resizable label with an image.
	 * @param img Image.
	 */
	public ResizableLabel(Image img){
		setImage(img);
	}
	
	/**
	 * Sets an image to label.
	 * @param img Image.
	 */
	public void setImage(Image img){
		this.img = img;
	}
	
	@Override
	public void paintComponent(Graphics g){	
		g.drawImage(img, 0, 0, getWidth(), getHeight(), 0, 0, img.getWidth(null), img.getHeight(null), null);
	}

}
